package menu;

import game.TextManager;

/**
 *
 * @author Luan
 */
public class MapMenu extends SimpleMenu {

    public MapMenu(int itemCode, String name) {
        super(itemCode, name, null, null);
    }

    @Override
    public Menu go() {
        Menu m = super.go();
        if (m != null && m instanceof AreaMap)
            ((AreaMap) m).prepareArea();
        return m;
    }

    @Override
    public void draw() {
        items = new SimpleMenu.SimpleMenuItem[2 + profile.getSave().getNivelAtual()];
        for (int i = 0; i < items.length; i++) {
            Menu submenu = null;
            if (i + 2 == profile.getSave().getNivelAtual())
                submenu = new AreaMap(this, profile.getSave().getCurrentKnownArea());
            items[i] = new SimpleMenu.SimpleMenuItem(-1, TextManager.t().MENU_ITEMS[2][i + 2 - profile.getSave().getNivelAtual()], submenu);
        }
        super.draw();
    }
}